import request from '@/utils/request'
// 获取所有角色列表
export function getAllRoleListAPI(params) {
  return request({
    url: '/sys/role',
    method: 'get',
    params
  })
}
// 根据id查询企业
export function getCompanyInfoAPI(companyId) {
  return request({
    url: `/company/${companyId}`
  })
}
// 添加角色
export function addRoleAPI(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}
// 根据ID获取角色详情
export function getRoleDetailsById(roleid) {
  return request({
    url: `/sys/role/${roleid}`
  })
}
// 根据ID更新角色
export function updateRoleByIdAPI(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}
// 根据ID删除角色
export function deleteRoleByIdAPI(roleid) {
  return request({
    url: `/sys/role/${roleid}`,
    method: 'delete'
  })
}
// 给角色分配权限
export function assignPremissionAPI(roleId, perIdArr) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data: {
      id: roleId,
      permIds: perIdArr
    }
  })
}
